export class animateCreater {
    /**
     * 动画并不写在class里。
     * @param scene 
     * @param name json名称
     * @param prefix json里某动作的名字
     * @param keyname 用于之后调取动画
     * @param Rate 帧率
     * @param repeat 重复次数。-1为一直重复。
     */
    private static newAnimate(scene: Phaser.Scene, name: string, prefix: string, keyname: string, Rate: number, repeat: number, endfame: number) {//之后导出素材，素材名称规范为：name + 01 + .png
        const anim = scene.anims.generateFrameNames(name, {
            start: 1, end: endfame, zeroPad: 1,
            prefix: prefix, suffix: '.png'
        });
        scene.anims.create({ key: keyname, frames: anim, frameRate: Rate, repeat: repeat });
    }

    public static setup(scene: Phaser.Scene) {
        animateCreater.newAnimate(scene, "wukong", "站", "wukong/stand", 10, -1, 2);
        animateCreater.newAnimate(scene, "wukong", "走", "wukong/walk", 10, -1, 5);
    }
}
